/**
 * Copyright (C) 2018-2022
 * All rights reserved, Designed By www.yixiang.co
 */
package co.yixiang.yshop.module.order.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * 售后状态枚举
 *
 * @author hupeng
 * @date 2023/6/23
 */
@Getter
@AllArgsConstructor
public enum AfterSalesStatusEnum {

    PENDING_REVIEW(0, "已提交等待平台审核"),
    AUDITED(1, "平台已审核,等待用户发货/退款"),
    USER_SHIPPED(2, "用户已发货"),
    REFUND_SUCCESS(3, "用户退款成功"),
    USER_CANCELLED(4, "用户已取消"),
    MERCHANT_REJECTION(5, "商家已拒绝"),
    TIME_OUT_CANCELLED(6, "超时取消"),

    ;

    private Integer value;
    private String desc;

    public static AfterSalesStatusEnum toType(int value) {
        return Stream.of(AfterSalesStatusEnum.values())
                .filter(p -> p.value == value)
                .findAny()
                .orElse(null);
    }


}
